const state = {
  fileServer: 'http://8.134.32.9:9000/arbook/',
  publicKey: '',
  resTypeOptions: []
}

const mutations = {
  SET_CONFIG: (state, config) => {
    const { fileServer, publicKey, resType } = config
    state.fileServer = fileServer
    state.publicKey = publicKey
    state.resTypeOptions = resType || []
  }
}

const actions = {
  setConfig({ commit }, config) {
    commit('SET_CONFIG', config)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
